package com.zsh.demo.service.impl;

import com.zsh.demo.dao.UserDao;
import com.zsh.demo.pojo.User;
import com.zsh.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Queue;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public User findByUser(String username, String password) {
        return userDao.findByUser(username,password);
    }

    @Override
    public List<User> getAllUser(String username, Integer pageNumber, Integer pageSize) {
        Integer pageStart=(pageNumber-1)*pageSize;
        return userDao.getAllUser(username,pageStart,pageSize);
    }

    @Override
    public Integer updateState(Integer id, Boolean state) {
        return userDao.updateState(id,state);
    }

    @Override
    public Integer addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public Integer deleteUser(Integer id) {
        return userDao.deleteUser(id);
    }
    //    @Override
//    public List<User> getAllUser(Queue queue) {
//        Integer number
//        return null;
//    }

    @Override
    public Integer getUserCounts(String username) {
        return userDao.getUserCounts(username);
    }

    @Override
    public Integer updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public User getUser(Integer id) {
        return userDao.getUser(id);
    }
}
